<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册</title>
<jsp:include page="../common/common.jsp"></jsp:include>
<style>
	#content{
		margin:100px auto;
		width:540px;
		height:350px;
		overflow: hidden;
	}
	#inner01{
		width:250px;
		height:323px;
		margin:10px auto;
		overflow: hidden;
	}
	#yzmjg{
		width:16px;
		height:16px;
		float: right;
		margin-right:40px;
		margin-top:5px; 
	}
	
	
/* http://localhost:8090/cunjin-dorm/login/login.jsp */
</style>
</head>
<body>
	<div id="content">
	
		<div id="p" class="easyui-panel" title="欢迎登陆"     
	        style="width:540px;height:350px;padding:10px;background:#fafafa;"   
	        data-options="">
	        
	        <div id="inner01">
	        
				  用&nbsp;&nbsp;户&nbsp;&nbsp;名:<input name="phone" class="easyui-textbox" value="123" data-options="iconCls:'icon-man'" style="width:170px;height:20px"> 
				  <br/><br/>
				  
				  密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:<input type="password" name="passwode" class="easyui-textbox" value="123" data-options="iconCls:'icon-lock'" style="width:170px;height:20px"> 
			

					<br/><br/>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<a id="lg" href="#" class="easyui-linkbutton" >注&nbsp;&nbsp;册</a>  
	        </div>
	</div>

</div>  

</body>
<script type="text/javascript">

		$('#lg').click(function(){
			
			
			var phone=$("input[name=phone]").val();
			var passwode=$("input[name=passwode]").val();
			
				$.ajax({
					'type':'post',
					'dateType':'json',
					'url':'${pageContext.request.contextPath}/admin/reg',
					'data':{
						'loginNo':phone,
						'password':passwode,
					},
					'success':function(msg){
						if(msg.code==200){
							
							$.messager.show({
								title:'注册成功',
								msg:'注册成功',
								timeout:1000,
								showType:'slide'
							});
							setTimeout(goMain(), 5000);
						}else{
							$.messager.show({
								title:'注册失败',
								msg:'账号已存在。',
								timeout:8000,
								showType:'slide'
							});
						}
					},
				});
		});
				
	function goMain(){
		window.location.href="${pageContext.request.contextPath}/login/login.jsp";
	}

</script>
</html>